package com.ruoyi.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Iterator;
import java.util.List;

/**
 * @ClassName WxMinConfig
 * @Deacription TODO
 * @Author Administrator
 * @Date 2021/2/27 16:01
 * @Version 1.0
 **/
@Component
@ConfigurationProperties(prefix = "wx.miniapp")
public class WxConfig {
    private List<Config> configs;
    public static String lsAppId="wxc8d6833c8a4f1000";
    public Config getConfig(String appId){
        Iterator<Config> it = configs.iterator();
        while (it.hasNext()) {
            Config c= it.next();
            if(appId.equals(c.getAppId())){
                return  c;
            }
        }
        return null;
    }
    public static class Config {
        private String appId;
        private String secret;
        private String keyPath;
        private String certPath;
        private String certP12Path;
        private String platformCertPath;
        private String mchId;
        private String apiKey3;
        private String apiKey;
        private String domain;

        public String getKeyPath() {
            return keyPath;
        }

        public void setKeyPath(String keyPath) {
            this.keyPath = keyPath;
        }

        public String getCertPath() {
            return certPath;
        }

        public void setCertPath(String certPath) {
            this.certPath = certPath;
        }

        public String getCertP12Path() {
            return certP12Path;
        }

        public void setCertP12Path(String certP12Path) {
            this.certP12Path = certP12Path;
        }

        public String getPlatformCertPath() {
            return platformCertPath;
        }

        public void setPlatformCertPath(String platformCertPath) {
            this.platformCertPath = platformCertPath;
        }

        public String getMchId() {
            return mchId;
        }

        public void setMchId(String mchId) {
            this.mchId = mchId;
        }

        public String getApiKey3() {
            return apiKey3;
        }

        public void setApiKey3(String apiKey3) {
            this.apiKey3 = apiKey3;
        }

        public String getApiKey() {
            return apiKey;
        }

        public void setApiKey(String apiKey) {
            this.apiKey = apiKey;
        }

        public String getDomain() {
            return domain;
        }

        public void setDomain(String domain) {
            this.domain = domain;
        }

        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public String getSecret() {
            return secret;
        }

        public void setSecret(String secret) {
            this.secret = secret;
        }
    }

    public List<Config> getConfigs() {
        return configs;
    }

    public void setConfigs(List<Config> configs) {
        this.configs = configs;
    }
}
